package com.jt.resource.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Slf4j
@Aspect
@Component
public class LogAspect {
    @Pointcut("@annotation(com.jt.resource.annotation.RequiredLog)")
    public void dolog(){
    }
    @Around("dolog()")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        log.debug("before{}",System.currentTimeMillis());
        Object result = joinPoint.proceed();//执行执行链(其他切面,目标方法)
        log.debug("after {}",System.currentTimeMillis());
        return result;//目标方法(切入点方法)的执行结果
    }
}
